﻿
namespace Cookies

[<AutoOpen>]
module ConsoleReader =
    let readLine = System.Console.ReadLine

    let readInt() = int (readLine())


module CookieClicked =
    let readInput() =   
        let line = readLine().Split() |> Array.map (fun x -> float x)
        match line with
        | [|C;F;X|] -> C, F, X
        | _ -> raise (new System.ArgumentException())

    let rec solve factoryCost factoryEfficiency goal currentEfficiency timeElapsed =
        let getFactoryTime =  factoryCost / currentEfficiency
        let afterFactoryGoal = goal - factoryCost
        let newEfficiency = currentEfficiency + factoryEfficiency

        if afterFactoryGoal / currentEfficiency < goal / newEfficiency then
            timeElapsed + goal / currentEfficiency
        else
            solve factoryCost factoryEfficiency goal newEfficiency (timeElapsed + getFactoryTime)

    let solveCase() =
        let C,F,X = readInput()
        solve C F X 2. 0.

    let solveCases nbOfCases =
        for i=1 to nbOfCases do
            printfn "Case #%d: %.7f" i (solveCase())